<?php echo '<?xml version="1.0" encoding="UTF-8"?>' ?>

<book xmlns="http://leganto.com/api">

	<id>{$book->getId()}</id>

	<language>{$book->language}</language>

	<title>{$book->title}</title>

	{if !empty($book->subtitle)}
	<subtitle>{$book->subtitle}</subtitle>
	{/if}

	<authors>
		{foreach $authors AS $author}
		<author>
			<id>{$author->getId()}</id>
			<type>{$author->type}</type>
			{if !empty($author->groupname)}
			<groupname>{$author->groupname}</groupname>
			{/if}
			{if !empty($author->firstname)}
			<firstname>{$author->firstname}</firstname>
			{/if}
			{if !empty($author->lastname)}
			<lastname>{$author->lastname}</lastname>
			{/if}
		</author>
		{/foreach}
	</authors>

	<rating>{$book->rating}</rating>

	<number-of-opinions>{$book->numberOfOpinions}</number-of-opinions>

	{if !empty($opinions)}
	<opinions>
		{foreach $opinions AS $opinion}
		<opinion>
			<id>{$opinion->getId()}</id>
			<user>
				<id>{$opinion->userId}</id>
				<name>{$opinion->userName}</name>
			</user>
			<inserted>{$opinion->inserted}</inserted>
			<rating>{$opinion->rating}</rating>
			<content>{$opinion->content}</content>
		</opinion>
		{/foreach}
	</opinions>
	{/if}

</book>